﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SchoolRoles
{
    public partial class Site : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var currentUser = Membership.GetUser();
            if (currentUser == null)
            {
                LiteralLogged.Text = "You are not logged in";
                ButtonLogout.Visible=false;
            }
            else
            {
                LiteralLogged.Text = "Hello "+currentUser.UserName;
                ButtonLogout.Visible = true;
            }
        }

        protected void ButtonLogout_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();
            FormsAuthentication.RedirectToLoginPage();
        }
    }
}